package Test;

import java.util.Scanner;

public class TTT6 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[][] res = new int[n][n];
        int value = 1;
        int loop = n / 2;
        int left = 0, top = 0, right = n - 1, bottom = n - 1;
        while (loop-- > 0) {
            int l = left;
            int t = top;
            int r = right;
            int b = bottom;
            for (int i = l; i < r; i++) {
                res[top][i] = value++;
            }
            for (int i = t; i < b; i++) {
                res[i][r] = value++;
            }
            for (int i = r; i > l; i--) {
                res[b][i] = value++;
            }
            for (int i = b; i > t; i--) {
                res[i][l] = value++;
            }
            left++;
            right--;
            top++;
            bottom--;
        }
        if (left == right){
            res[left][top] = value;
        }
        for (int i = 0; i < res.length; i++) {
            for (int j = 0; j < res[0].length; j++) {
                System.out.print(res[i][j]+" ");
            }
            System.out.println();
        }
    }
}
